#!/bin/bash
set -e

apt-get update
apt-get install -qy git

git clone https://github.com/pyenv/pyenv.git "${HOME}/.pyenv"

cat > "${HOME}/.bashrc" <<'EOF'
export PATH="${HOME}/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
EOF

# dependencies needed to build python
apt-get install -qy \
        make build-essential libssl-dev zlib1g-dev \
        libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
        libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev


echo "Path is now: $PATH, shell is $SHELL"
exit 0
